#pragma once

#include "form/IControl.h"
#include "form/Formtypes.h"

template<typename T>
class Control: public T
{
public:
	BEGIN_DEFINE_CLASS(CLASSID_NULL)
		DEFINE_INTERFACE_ENTRY(IControl)
	END_DEFINE_CLASS()

	Control()
	{
		m_caption = L"";
		m_description = L"";
		m_tip = L"";
		m_icon = NULL;
		m_begingroup = false;
		m_enabled = true;
		m_visible = true;
		m_commandID = 0;
	}
	virtual ~Control(){}

	virtual void SetCaption(const String& value) { m_caption = value; }
	virtual void SetDescription(const String& value) { m_description = value; }
	virtual void SetTip(const String& value) { m_tip = value; }
	virtual void SetHotKey(const Hotkey& value) { m_hotkey = value; }
	virtual void SetICon(vSysICon value) { m_icon = value; }
	virtual void SetBeginGroup(bool value=true) { m_begingroup = value; }
	virtual void SetEnabled(bool value=true) { m_visible = value; }
	virtual void SetVisible(bool value=true) { m_enabled = value; }

	virtual const String& GetCaption() const { return m_caption; }
	virtual const String& GetDescription() const { return m_description; }
	virtual const String& GetTip() const {return m_tip;}
	virtual const Hotkey& GetHotKey() const { return m_hotkey;}
	virtual vSysICon GetICon() const { return m_icon;} 
	virtual bool GetBeginGroup() const { return m_begingroup;}
	virtual bool IsEnabled() const { return m_enabled;}
	virtual bool IsVisible() const { return m_visible;}

	virtual uint32 GetCommandID() const { return m_commandID; }
	virtual void SetCommandID(uint32 value) { m_commandID = value;}

	event_implement(ClickEventHandler,Click);
	event_implement(UpdateUIEventHandler,UpdateUI);
	event_implement(ErrorEventHandler,Error);

private:
	String m_caption;
	String m_description;
	String m_tip;
	Hotkey m_hotkey;
	vSysICon m_icon;
	bool m_begingroup;
	bool m_enabled;
	bool  m_visible;

	uint32 m_commandID;
};
